package com.dashunzi.yueyutianqi.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.BaseColumns;

/**
 * 越狱天气的数据库操作帮助类
 * Created by Administrator on 2016/4/9 0009.
 * 作者：大顺子
 */
public class YueYuWeatherOpenHelper extends SQLiteOpenHelper {
    //Province表的建表初始化
    public static final String CREATE_PROVINCE = "create table Province("
            + "_id integer primary key autoincrement,"
            + "province_name text,"
            + "province_code text)";
    //City表的建表初始化
    public static final String CREATE_CITY = "create table City("
            + "_id integer primary key autoincrement,"
            + "city_name text,"
            + "city_code text,"
            + "province_id integer)";
    //Country表的建表初始化
    public static final String CREATE_COUNTY = "create table County("
            + "_id integer primary key autoincrement,"
            + "county_name text,"
            + "county_code text,"
            + "city_id integer)";

    //构造方法的初始化
    public YueYuWeatherOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_PROVINCE);//创建province表
        db.execSQL(CREATE_CITY);//创建City表
        db.execSQL(CREATE_COUNTY);//创建Country表
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
